From: Ramez Medhat Date: Sat, 28 Mar 2026 15:14:15 +0000 (+0200) Subject: screenshot: Snap cursor to the center of the handle on press X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~10^2^2~44 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=9c2712214a1ddc02fb37b605dfdd8a5dd7a4db8b;p=gnome-shell.git screenshot: Snap cursor to the center of the handle on press When dragging the screenshot area handle from the outer sides, it is currently impossible to move them to the edges or corners of the screen, as the cursor is constrained to the monitor. Fix this by snapping the cursor to the center of the handle when starting the resize operation. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/9113 Part-of: --- diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index e0ec8b76a..499baa8f4 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -481,6 +481,44 @@ const UIAreaSelector = GObject.registerClass({ const rightX = leftX + width - 1; const bottomY = topY + height - 1; + let snapX = this._dragStartX; + let snapY = this._dragStartY; + + switch (cursor) { + case Clutter.CursorType.NW_RESIZE: + snapX = leftX; + snapY = topY; + break; + case Clutter.CursorType.NE_RESIZE: + snapX = rightX; + snapY = topY; + break; + case Clutter.CursorType.SW_RESIZE: + snapX = leftX; + snapY = bottomY; + break; + case Clutter.CursorType.SE_RESIZE: + snapX = rightX; + snapY = bottomY; + break; + case Clutter.CursorType.N_RESIZE: + snapY = topY; + break; + case Clutter.CursorType.S_RESIZE: + snapY = bottomY; + break; + case Clutter.CursorType.W_RESIZE: + snapX = leftX; + break; + case Clutter.CursorType.E_RESIZE: + snapX = rightX; + break; + } + + const backend = this.get_context().get_backend(); + backend.get_default_seat().warp_pointer(snapX, snapY); + [this._dragStartX, this._dragStartY] = [snapX, snapY]; + // For moving, start X and Y are the top left corner, while // last X and Y are the bottom right corner. if (cursor === Clutter.CursorType.MOVE) {